const Service = require('egg').Service;

class StudentService extends Service {
    async getStudentList() {
        try {
            let clazzList = await this.app.model.Clazz.findAll()
            return clazzList;
        } catch (e) {
            return null;
        }
    }
    async createClazz(name) {
        try {
            await this.app.model.Clazz.create({
                name: name
            })
            return true;
        }catch(e){
            return false
        }
    }
    async destroyClazz(id) {
        try {
            await this.app.model.Clazz.destroy({
                where: {
                    id
                }
            })
            return true
        } catch (e) {
            return false
        }
    }
}
module.exports = StudentService;